@extends('home.layouts._center')
@section('content')
    <div class="mod_main">
        <div class="jib_xinx_kuang">
            <div class="shand_piaot">我的订单明细表</div>
            <div class="tab_trigger tab_trigger_wod_dd">
                <p class="attrK">实物订单：</p>
                <ul>
                    <li><a class="text_shaid" href="#">全部</a></li>
                    <li><a class="text_shaid" href="#">代付款</a><p class="sup">1</p></li>
                    <li><a class="text_shaid" href="#">待收货</a><p class="sup">1</p></li>
                    <li><a class="text_shaid" href="pingj_shaid.html">待评价</a><p class="sup">3</p></li>
                </ul>
            </div>
            <!--************************************-->
            <table class="order-tb order-tb_1">
                <colgroup>
                    <col class="number-col">
                    <col class="consignee-col">
                    <col class="amount-col">
                    <col class="operate-col">
                    <col class="dis_col">
                </colgroup>
                <thead>
                <tr>
                    <th>订单详情</th>
                    <th>金额</th>
                    <th>
                        <div class="combox combox_2">
                            <div><span class="c-lable" val="1">订单状态</span><i></i></div>
                            <ul class="c-list-value">
                                <li class=""><a href="#" val="2017">等待付款</a></li>
                                <li class=""><a href="#" val="2016">等待收货</a></li>
                                <li class=""><a href="#" val="2015">已完成</a></li>
                                <li class=""><a href="#" val="3">已取消</a></li>
                            </ul>
                        </div>
                    </th>
                    <th>收货人</th>
                    <th>操作</th>
                </tr>
                </thead>
                    <tbody>
                    <tr class="sep-row"><td colspan="4"></td></tr>
                    <tr class="tr-th">
                        <td colspan="5">
                            <span class="gap"></span>
                            <span class="dealtime span_30" title="2015-1-19 10:30:42">{{$order['created_at']}}</span>
                            <span class="number span_30">订单号：{{$order['order_num']}}</span>
                            <span class="number span_30">收货地址：{{$order->address['address']}} {{$order->address['area']}}</span>
                            <span class="wod_sc_delete_beij span_30" onclick="del(this)"><a href="javascript:;" class="wod_dingd_delete" title="点击删除"></a></span>
                            <form action="{{route('home.order.destroy',$order)}}" method="post">
                                @csrf @method('DELETE')
                            </form>
                        </td>
                    </tr>
                    @foreach($order->orderDetails as $orderDetail)
                        <tr class="tr-bd">
                            <td rowspan="1">
                                <div class="goods-item">
                                    <div class="p-img">
                                        <a href="{{route('home.content',$orderDetail->good)}}">
                                            <img src="{{$orderDetail->good->picture[0]}}" alt="点击查看商品详细信息">
                                        </a>
                                    </div>
                                    <div class="p-msg">
                                        <div class="p-name">
                                            <a  href="{{route('home.content',$orderDetail->good)}}">{{$orderDetail->good->title}} {{$orderDetail->bale->natures}}</a>
                                        </div>
                                    </div>
                                </div>
                                <div class="goods-number">{{$orderDetail->num}}</div>
                            </td>
                            <td rowspan="1">
                                <div class="zhif_jine">
                                    <p>总额￥{{$order->total_price}}</p>
                                    <span>在线支付</span>
                                </div>
                            </td>
                            <td rowspan="1">
                                <div class="operate">
                                    <p class="yiwanc_hui">{{$order->status}}</p>
                                </div>
                            </td>
                            <td rowspan="1">
                                <div class="txt_ren">
                                    <span>{{$order->address->linkname}}</span>
                                    <p class="ren_tub"></p>
                                </div>
                            </td>
                            <td rowspan="1">
                                <div class="operate">
                                    <a href="{{route('home.order.pay',$order['order_num'])}}" class="btn-def">立即购买</a>
                                </div>
                            </td>
                        </tr>
                    @endforeach
                    </tbody>
            </table>
        </div>
    </div>
@endsection
@push('js')
    <script>
        function del(v) {
            if (confirm('确定删除吗？')){
                $(v).next().submit();
            }
        }
    </script>
@endpush
